#ifndef _CONNECTMANAGER_H
#define _CONNECTMANAGER_H
#include <boost/circular_buffer.hpp>
#include <map>
#include <memory>
#include <string>
enum LINKTYPE {
	TCP,
	UDP
};
class linkinfo {
    protected:
	std::string dest_ip;
	unsigned int dest_port;
	std::string local_ip;
	unsigned int local_port;
	LINKTYPE linktype;

    public:
	linkinfo(const std::string& dstip, const unsigned int dstport, const std::string& localip, const unsigned int localport, const LINKTYPE linktype);
	virtual ~linkinfo();
	bool operator<(const linkinfo& cmp);
};

class connectsession {
    private:
	typedef unsigned long long bufferlen;
	linkinfo link;
	std::unique_ptr<char[]> readBuffer;
	std::unique_ptr<char[]> writeBuffer;
	bufferlen readBufferlen;
	bufferlen writeBufferlen;

    public:
	connectsession();
	virtual ~connectsession();
};

class linkidgenerate {
};

class connectmanager {
    private:
	std::map<int, linkinfo> linkmap;

    public:
	int AddNewConnect();
	void RemoveConnect(int);
	std::weak_ptr<connectsession> GetOneConnect(int);
};

#endif
